<?php

declare (strict_types=1);

namespace App\Common\Model\Admin;

use Zms\Basics\BasicsModel;
use Zms\HyperfCasts\ArrjoinCasts;
use Zms\HyperfCasts\JsonCasts;
use Zms\HyperfCasts\StrtotimeCasts;

/**
 * @property int $id
 * @property int $pid 上级菜单
 * @property string $group 分组
 * @property string $name 名称
 * @property string $path 路由
 * @property array $node 权限节点
 * @property int $sort 排序
 * @property int $is_nav 左侧菜单
 * @property int $debug 开发模式
 * @property string $icon 图标
 * @property int $level 菜单层级
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 */
class MenuModel extends BasicsModel
{
    /**
     * The table associated with the model.
     *
     * @var null|string
     */
    protected ?string $table = 'admin_menu';


    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected array $fillable = [];


    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected array $casts = [
        'id' => 'int',
        'pid' => 'integer',
        'sort' => 'integer',
        'is_nav' => 'integer',
        'debug' => 'integer',
        'level' => 'integer',
        'node' => JsonCasts::class,
        'group' => ArrjoinCasts::class,
        'created_at' => StrtotimeCasts::class,
        'updated_at' => StrtotimeCasts::class
    ];
}

